* California Probation Org Capacity
* 1.9.20 

clear all 

use "/Users/aerick/Desktop/jpart_lihp/jpart_lihp_data.dta", clear


// Main Tables & Figures
*****
*****
*****
* Table 1
*2008-2013
sum felony_failure lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr if before_full_expansion_flag==1

*2008-2013 Group Untreated
sum felony_failure lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr if before_full_expansion_flag==1 & lihp==0

*2008-2013 Group Treated
sum felony_failure lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr if before_full_expansion_flag==1 & lihp==1


xtset countyid linear_month


*****
*****
*****
* Table 2 Baseline DD
* DD no controls
 xtreg felony_failure lihp officer_probationer_ratio i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1 

* DD w/ controls
 xtreg felony_failure lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1

 

*****
*****
*****
* Table 3
* DDD Interaction no controls
 xtreg felony_failure lihp##c.officer_probationer_ratio i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1 

* DDD Interaction w/ controls
 xtreg felony_failure lihp##c.officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1



*****
*****
*****
* Figure 2 Event Study Regression
coefplot, vertical keep(half_expansion_n6 half_expansion_n5 half_expansion_n4 half_expansion_n3 half_expansion_n2  reference half_expansion_z half_expansion_p1 half_expansion_p2 half_expansion_p3 half_expansion_p4 half_expansion_p5) title("Effect of LIHP on Adult Felony Probation Revocation") subtitle("Half-Year Time Periods") yline(0, lcolor(black)) xline(6.5, lpattern(dash)) graphregion(color(white)) levels(90) omitted baselevels coeflabels(half_expansion_n6="31+ months pre" half_expansion_n5="25-30 months pre" half_expansion_n4="19-24 months pre" half_expansion_n3="13-18 months pre" half_expansion_n2="7-12 months pre"  reference="1-6 months pre" half_expansion_z="0-5 months post" half_expansion_p1="6-11 months post" half_expansion_p2="12-17 months post" half_expansion_p3="18-23 months post" half_expansion_p4="24+ months post") ytitle("Medicaid Expansion Coefficient") recast(connected)



*****
*****
*****
* Figure 3 Marginal plots graph code for DDD
xtreg felony_failure lihp##c.officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1. 


margins , dydx(lihp) at(officer_probationer_ratio=(0(1)30)) vsquish


marginsplot, recast(line) recastci(rarea) yline(0)

marginsplot, yline(0) 



// Appendix
*****
*****
*****
* Table A2 Event Study Regression Results
 xtreg felony_failure half_expansion_n6 half_expansion_n5 half_expansion_n4 half_expansion_n3 half_expansion_n2  reference half_expansion_z half_expansion_p1 half_expansion_p2 half_expansion_p3 half_expansion_p4  officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1
 
 
*****  
*****
*****
* Table A3 Placebo Test 
* Department Staffing
 xtreg log_officer lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1

* Department funding
 xtreg log_expenditures lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_pop log_ucr i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1


*****
*****
*****
*Table A4 DD Robustness Checks (table 2)
* Region-by-month FE
 xtreg felony_failure lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month i.linear_month#i.region, fe cluster(countyid), if before_full_expansion_flag==1

* with county-specific linear time trends
 xtreg felony_failure lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month i.linear_month#i.region c.linear_month#i.countyid, fe cluster(countyid), if before_full_expansion_flag==1

* Weighted by county pop
 xtreg felony_failure lihp officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month i.linear_month#i.region c.linear_month#i.countyid [aw=pop_mean], fe cluster(countyid), if before_full_expansion_flag==1

 
*****
*****
*****
 *Table A5 DDD Robustness Checks (Table 3)
* Region-by-month FE
 xtreg felony_failure lihp##c.officer_probationer_ratio officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month i.linear_month#i.region, fe cluster(countyid), if before_full_expansion_flag==1

* with county-specific linear time trends
 xtreg felony_failure lihp##c.officer_probationer_ratio officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month i.linear_month#i.region c.linear_month#i.countyid, fe cluster(countyid), if before_full_expansion_flag==1

* Weighted by county pop
 xtreg felony_failure lihp##c.officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month i.linear_month#i.region c.linear_month#i.countyid [aw=pop_mean], fe cluster(countyid), if before_full_expansion_flag==1
 
*****
*****
*****
* Table A6 Quadruple diff Robustness check
* DDDD
 xtreg felony_failure lihp##substance_abuse_covered##c.officer_probationer_ratio i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1 

* DDDD w/ controls
 xtreg felony_failure lihp##substance_abuse_covered##c.officer_probationer_ratio perc_white perc_black perc_hisp perc_female Unemployment_rate pov_rate_all_ages log_median_income log_expenditures log_pop log_ucr i.linear_month, fe cluster(countyid), if before_full_expansion_flag==1

